//
//  NSData+NSDataExtend.m
//  etionMisc
//
//  Created by wu jingxing on 13-1-27.
//  Copyright (c) 2013年 GuangZhouXuanWu. All rights reserved.
//

#import "NSDataExtend.h"

#import "NSStringExtend.h"

@implementation NSData (NSDataExtend)

+(NSData*)hexStringToNSData:(NSArray*)arHex
{
    char* c = malloc(arHex.count);
    for(NSUInteger i = 0; i < arHex.count; i++)
    {
        NSString* s = [arHex objectAtIndex:i];
        NSUInteger ii = [NSString hexToUInt:s];
        c[i] = ii;
    }
    NSData *data = [NSData dataWithBytes:c length:arHex.count];
    free(c);
    return data;
}

@end
